﻿namespace Forms
{
    using Forms.My;
    using Forms.My.Resources;

    using Microsoft.VisualBasic;
    using Microsoft.VisualBasic.CompilerServices;

    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class frmHistorie : Form
    {
        [AccessedThroughProperty("AbloeseBetragDataGridViewTextBoxColumn")]
        private DataGridViewTextBoxColumn _AbloeseBetragDataGridViewTextBoxColumn;
        [AccessedThroughProperty("AbloeseDatumDataGridViewTextBoxColumn")]
        private DataGridViewTextBoxColumn _AbloeseDatumDataGridViewTextBoxColumn;
        [AccessedThroughProperty("DataGridView1")]
        private DataGridView _DataGridView1;
        [AccessedThroughProperty("DatenschemaBMW")]
        private DatenschemaBMW _DatenschemaBMW;
        [AccessedThroughProperty("FGSTNrDataGridViewTextBoxColumn")]
        private DataGridViewTextBoxColumn _FGSTNrDataGridViewTextBoxColumn;
        [AccessedThroughProperty("InnerCbx")]
        private ComboBox _InnerCbx;
        [AccessedThroughProperty("KreditNrDataGridViewTextBoxColumn")]
        private DataGridViewTextBoxColumn _KreditNrDataGridViewTextBoxColumn;
        [AccessedThroughProperty("Kunden_Nr")]
        private DataGridViewTextBoxColumn _Kunden_Nr;
        [AccessedThroughProperty("NameDataGridViewTextBoxColumn")]
        private DataGridViewTextBoxColumn _NameDataGridViewTextBoxColumn;
        [AccessedThroughProperty("REDatVKDataGridViewTextBoxColumn")]
        private DataGridViewTextBoxColumn _REDatVKDataGridViewTextBoxColumn;
        [AccessedThroughProperty("RENrVKDataGridViewTextBoxColumn")]
        private DataGridViewTextBoxColumn _RENrVKDataGridViewTextBoxColumn;
        [AccessedThroughProperty("TAB_HistorieBindingSource")]
        private BindingSource _TAB_HistorieBindingSource;
        [AccessedThroughProperty("ToolStrip1")]
        private ToolStrip _ToolStrip1;
        [AccessedThroughProperty("ToolStripButtonExportToExcel")]
        private ToolStripButton _ToolStripButtonExportToExcel;
        [AccessedThroughProperty("ToolStripComboBoxJahre")]
        private ToolStripComboBox _ToolStripComboBoxJahre;
        [AccessedThroughProperty("ToolStripLabel1")]
        private ToolStripLabel _ToolStripLabel1;
        [AccessedThroughProperty("ToolStripLabelSuchen")]
        private ToolStripLabel _ToolStripLabelSuchen;
        [AccessedThroughProperty("ToolStripSeparator1")]
        private ToolStripSeparator _ToolStripSeparator1;
        [AccessedThroughProperty("ToolStripSeparator2")]
        private ToolStripSeparator _ToolStripSeparator2;
        [AccessedThroughProperty("ToolStripTextBoxSuchen")]
        private ToolStripTextBox _ToolStripTextBoxSuchen;
        private bool CbxEventsEnabled;
        private IContainer components;
        private DataView dvHist;
        private DateTime EndDatum;
        private DateTime StartDatum;

        public frmHistorie()
        {
            base.Load += new EventHandler(this.frmHistorie_Load);
            base.Shown += new EventHandler(this.frmHistorie_Shown);
            this.dvHist = null;
            this.CbxEventsEnabled = true;
            this.InitializeComponent();
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (disposing && (this.components != null))
                {
                    this.components.Dispose();
                }
            }
            finally
            {
                base.Dispose(disposing);
            }
        }

        private void frmHistorie_Load(object sender, EventArgs e)
        {
            this.dvHist = new DataView(MyProject.Forms.Main.cs.Table_Historie, "", "Abloese_Datum DESC", DataViewRowState.CurrentRows);
            this.DataGridView1.DataSource = this.dvHist;
            this.DataGridView1.ReadOnly = true;
            this.CbxEventsEnabled = false;
            this.InnerCbx = this.ToolStripComboBoxJahre.ComboBox;
            ArrayList list = new ArrayList();
            int num = DateAndTime.Year(DateAndTime.Now);
            int num2 = num - 2;
            list.Add("Alle");
            int num4 = num2;
            for (int i = num; i >= num4; i += -1)
            {
                list.Add(i.ToString());
            }
            this.InnerCbx.DataSource = list;
            this.CbxEventsEnabled = true;
        }

        private void frmHistorie_Shown(object sender, EventArgs e)
        {
            this.dvHist.RowFilter = "";
            this.ToolStripTextBoxSuchen.Text = "";
        }

        internal void GridToExcel(DataGridView Grid)
        {
            object instance = null;
            object objectValue = null;
            object obj4 = null;
            try
            {
                object obj5;
                IEnumerator enumerator;
                IEnumerator enumerator2;
                IEnumerator enumerator4;
                object obj10;
                objectValue = RuntimeHelpers.GetObjectValue(Interaction.CreateObject("Excel.Application", ""));
                instance = RuntimeHelpers.GetObjectValue(NewLateBinding.LateGet(NewLateBinding.LateGet(objectValue, null, "Workbooks", new object[0], null, null, null), null, "Add", new object[0], null, null, null));
                obj4 = RuntimeHelpers.GetObjectValue(NewLateBinding.LateGet(instance, null, "Worksheets", new object[] { 1 }, null, null, null));
                int num2 = 1;
                int num = 1;
                MyProject.Forms.Main.StatusLabel.Text = "Export nach Excel";
                MyProject.Forms.Main.StatusProgress.Minimum = 0;
                MyProject.Forms.Main.StatusProgress.Maximum = this.dvHist.Count + 1;
                MyProject.Forms.Main.StatusProgress.Value = 0;
                object[] arguments = new object[] { num2, num };
                bool[] copyBack = new bool[] { true, true };
                if (copyBack[0])
                {
                    num2 = (int) Conversions.ChangeType(RuntimeHelpers.GetObjectValue(arguments[0]), typeof(int));
                }
                if (!copyBack[1])
                {
                    obj5 = NewLateBinding.LateGet(obj4, null, "cells", arguments, null, null, copyBack);
                }
                else
                {
                    num = (int) Conversions.ChangeType(RuntimeHelpers.GetObjectValue(arguments[1]), typeof(int));
                    obj5 = NewLateBinding.LateGet(obj4, null, "cells", arguments, null, null, copyBack);
                }
                NewLateBinding.LateSetComplex(obj5, null, "value", new object[] { "Export vom: " + Conversions.ToString(DateAndTime.Now) }, null, null, false, true);
                NewLateBinding.LateSetComplex(NewLateBinding.LateGet(obj5, null, "Interior", new object[0], null, null, null), null, "colorindex", new object[] { 15 }, null, null, false, true);
                NewLateBinding.LateSetComplex(obj5, null, "HorizontalAlignment", new object[] { -4108 }, null, null, false, true);
                NewLateBinding.LateSetComplex(NewLateBinding.LateGet(obj5, null, "Font", new object[0], null, null, null), null, "Bold", new object[] { true }, null, null, false, true);
                obj5 = null;
                num2 = 2;
                try
                {
                    enumerator = Grid.Columns.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        DataGridViewColumn current = (DataGridViewColumn) enumerator.Current;
                        if (current.Visible)
                        {
                            object obj6;
                            arguments = new object[] { num2, num };
                            copyBack = new bool[] { true, true };
                            if (copyBack[0])
                            {
                                num2 = (int) Conversions.ChangeType(RuntimeHelpers.GetObjectValue(arguments[0]), typeof(int));
                            }
                            if (!copyBack[1])
                            {
                                obj6 = NewLateBinding.LateGet(obj4, null, "cells", arguments, null, null, copyBack);
                            }
                            else
                            {
                                num = (int) Conversions.ChangeType(RuntimeHelpers.GetObjectValue(arguments[1]), typeof(int));
                                obj6 = NewLateBinding.LateGet(obj4, null, "cells", arguments, null, null, copyBack);
                            }
                            NewLateBinding.LateSetComplex(obj6, null, "value", new object[] { current.HeaderText }, null, null, false, true);
                            NewLateBinding.LateSetComplex(NewLateBinding.LateGet(obj6, null, "Interior", new object[0], null, null, null), null, "colorindex", new object[] { 15 }, null, null, false, true);
                            NewLateBinding.LateSetComplex(obj6, null, "HorizontalAlignment", new object[] { -4108 }, null, null, false, true);
                            NewLateBinding.LateSetComplex(NewLateBinding.LateGet(obj6, null, "Font", new object[0], null, null, null), null, "Bold", new object[] { true }, null, null, false, true);
                            num++;
                        }
                    }
                }
                finally
                {
                    //if (enumerator is IDisposable)
                    //{
                    //    (enumerator as IDisposable).Dispose();
                    //}
                }
                num2 = 3;
                try
                {
                    enumerator2 = ((IEnumerable) Grid.Rows).GetEnumerator();
                    while (enumerator2.MoveNext())
                    {
                        IEnumerator enumerator3;
                        DataGridViewRow row = (DataGridViewRow) enumerator2.Current;
                        num = 1;
                        ToolStripProgressBar statusProgress = MyProject.Forms.Main.StatusProgress;
                        statusProgress.Value++;
                        try
                        {
                            enumerator3 = Grid.Columns.GetEnumerator();
                            while (enumerator3.MoveNext())
                            {
                                DataGridViewColumn column2 = (DataGridViewColumn) enumerator3.Current;
                                if (column2.Visible)
                                {
                                    object obj7;
                                    arguments = new object[] { num2, num };
                                    copyBack = new bool[] { true, true };
                                    if (copyBack[0])
                                    {
                                        num2 = (int) Conversions.ChangeType(RuntimeHelpers.GetObjectValue(arguments[0]), typeof(int));
                                    }
                                    if (!copyBack[1])
                                    {
                                        obj7 = NewLateBinding.LateGet(obj4, null, "cells", arguments, null, null, copyBack);
                                    }
                                    else
                                    {
                                        num = (int) Conversions.ChangeType(RuntimeHelpers.GetObjectValue(arguments[1]), typeof(int));
                                        obj7 = NewLateBinding.LateGet(obj4, null, "cells", arguments, null, null, copyBack);
                                    }
                                    if (column2.ValueType == typeof(TimeSpan))
                                    {
                                        TimeSpan span = (TimeSpan) row.Cells[column2.Index].Value;
                                        string str = Strings.Format(Convert.ToDateTime(span.ToString()), "dd.MM.yyyy");
                                        NewLateBinding.LateSetComplex(obj7, null, "value", new object[] { str }, null, null, false, true);
                                    }
                                    else if (column2.ValueType == typeof(double))
                                    {
                                        NewLateBinding.LateSetComplex(obj7, null, "value", new object[] { RuntimeHelpers.GetObjectValue(row.Cells[column2.Index].Value) }, null, null, false, true);
                                        NewLateBinding.LateSetComplex(obj7, null, "NumberFormat", new object[] { "###.###.##0,00" }, null, null, false, true);
                                    }
                                    else
                                    {
                                        NewLateBinding.LateSetComplex(obj7, null, "value", new object[] { RuntimeHelpers.GetObjectValue(row.Cells[column2.Index].Value) }, null, null, false, true);
                                    }
                                    NewLateBinding.LateSetComplex(obj7, null, "HorizontalAlignment", new object[] { -4152 }, null, null, false, true);
                                    if (column2.ValueType == typeof(string))
                                    {
                                        NewLateBinding.LateSetComplex(obj7, null, "horizontalalignment", new object[] { -4131 }, null, null, false, true);
                                    }
                                    if (row.DefaultCellStyle.BackColor == Color.Yellow)
                                    {
                                        NewLateBinding.LateSetComplex(NewLateBinding.LateGet(obj7, null, "Interior", new object[0], null, null, null), null, "colorindex", new object[] { 6 }, null, null, false, true);
                                    }
                                    obj7 = null;
                                    num++;
                                }
                            }
                        }
                        finally
                        {
                            //if (enumerator3 is IDisposable)
                            //{
                            //    (enumerator3 as IDisposable).Dispose();
                            //}
                        }
                        arguments = new object[] { num2 };
                        copyBack = new bool[] { true };
                        if (copyBack[0])
                        {
                            num2 = (int) Conversions.ChangeType(RuntimeHelpers.GetObjectValue(arguments[0]), typeof(int));
                        }
                        NewLateBinding.LateCall(NewLateBinding.LateGet(obj4, null, "Rows", arguments, null, null, copyBack), null, "Autofit", new object[0], null, null, null, true);
                        num2++;
                    }
                }
                finally
                {
                    //if (enumerator2 is IDisposable)
                    //{
                    //    (enumerator2 as IDisposable).Dispose();
                    //}
                }
                num = 1;
                try
                {
                    enumerator4 = Grid.Columns.GetEnumerator();
                    while (enumerator4.MoveNext())
                    {
                        DataGridViewColumn column3 = (DataGridViewColumn) enumerator4.Current;
                        if (column3.Visible)
                        {
                            arguments = new object[] { num };
                            copyBack = new bool[] { true };
                            if (copyBack[0])
                            {
                                num = (int) Conversions.ChangeType(RuntimeHelpers.GetObjectValue(arguments[0]), typeof(int));
                            }
                            NewLateBinding.LateCall(NewLateBinding.LateGet(obj4, null, "Columns", arguments, null, null, copyBack), null, "AutoFit", new object[0], null, null, null, true);
                            num++;
                        }
                    }
                }
                finally
                {
                    //if (enumerator4 is IDisposable)
                    //{
                    //    (enumerator4 as IDisposable).Dispose();
                    //}
                }
                object[] objArray = new object[2];
                object obj8 = obj4;
                object[] objArray3 = new object[2];
                int num3 = 1;
                objArray3[0] = num3;
                int num4 = 1;
                objArray3[1] = num4;
                objArray[0] = RuntimeHelpers.GetObjectValue(NewLateBinding.LateGet(obj8, null, "Cells", objArray3, null, null, null));
                object obj9 = obj4;
                arguments = new object[2];
                int num5 = num2 - 1;
                arguments[0] = num5;
                int num6 = num - 1;
                arguments[1] = num6;
                objArray[1] = RuntimeHelpers.GetObjectValue(NewLateBinding.LateGet(obj9, null, "Cells", arguments, null, null, null));
                object[] objArray4 = objArray;
                copyBack = new bool[] { true, true };
                if (copyBack[0])
                {
                    NewLateBinding.LateSetComplex(obj8, null, "Cells", new object[] { num3, num4, RuntimeHelpers.GetObjectValue(objArray4[0]) }, null, null, true, false);
                }
                if (!copyBack[1])
                {
                    obj10 = NewLateBinding.LateGet(obj4, null, "Range", objArray4, null, null, copyBack);
                }
                else
                {
                    NewLateBinding.LateSetComplex(obj9, null, "Cells", new object[] { num5, num6, RuntimeHelpers.GetObjectValue(objArray4[1]) }, null, null, true, false);
                    obj10 = NewLateBinding.LateGet(obj4, null, "Range", objArray4, null, null, copyBack);
                }
                object obj11 = NewLateBinding.LateGet(obj10, null, "Borders", new object[] { 7 }, null, null, null);
                NewLateBinding.LateSetComplex(obj11, null, "LineStyle", new object[] { 1 }, null, null, false, true);
                NewLateBinding.LateSetComplex(obj11, null, "Weight", new object[] { 2 }, null, null, false, true);
                NewLateBinding.LateSetComplex(obj11, null, "ColorIndex", new object[] { -4105 }, null, null, false, true);
                obj11 = null;
                object obj12 = NewLateBinding.LateGet(obj10, null, "Borders", new object[] { 8 }, null, null, null);
                NewLateBinding.LateSetComplex(obj12, null, "LineStyle", new object[] { 1 }, null, null, false, true);
                NewLateBinding.LateSetComplex(obj12, null, "Weight", new object[] { 2 }, null, null, false, true);
                NewLateBinding.LateSetComplex(obj12, null, "ColorIndex", new object[] { -4105 }, null, null, false, true);
                obj12 = null;
                object obj13 = NewLateBinding.LateGet(obj10, null, "Borders", new object[] { 9 }, null, null, null);
                NewLateBinding.LateSetComplex(obj13, null, "LineStyle", new object[] { 1 }, null, null, false, true);
                NewLateBinding.LateSetComplex(obj13, null, "Weight", new object[] { 2 }, null, null, false, true);
                NewLateBinding.LateSetComplex(obj13, null, "ColorIndex", new object[] { -4105 }, null, null, false, true);
                obj13 = null;
                object obj14 = NewLateBinding.LateGet(obj10, null, "Borders", new object[] { 10 }, null, null, null);
                NewLateBinding.LateSetComplex(obj14, null, "LineStyle", new object[] { 1 }, null, null, false, true);
                NewLateBinding.LateSetComplex(obj14, null, "Weight", new object[] { 2 }, null, null, false, true);
                NewLateBinding.LateSetComplex(obj14, null, "ColorIndex", new object[] { -4105 }, null, null, false, true);
                obj14 = null;
                object obj15 = NewLateBinding.LateGet(obj10, null, "Borders", new object[] { 11 }, null, null, null);
                NewLateBinding.LateSetComplex(obj15, null, "LineStyle", new object[] { 1 }, null, null, false, true);
                NewLateBinding.LateSetComplex(obj15, null, "Weight", new object[] { 2 }, null, null, false, true);
                NewLateBinding.LateSetComplex(obj15, null, "ColorIndex", new object[] { -4105 }, null, null, false, true);
                obj15 = null;
                object obj16 = NewLateBinding.LateGet(obj10, null, "Borders", new object[] { 12 }, null, null, null);
                NewLateBinding.LateSetComplex(obj16, null, "LineStyle", new object[] { 1 }, null, null, false, true);
                NewLateBinding.LateSetComplex(obj16, null, "Weight", new object[] { 2 }, null, null, false, true);
                NewLateBinding.LateSetComplex(obj16, null, "ColorIndex", new object[] { -4105 }, null, null, false, true);
                obj16 = null;
                obj10 = null;
                NewLateBinding.LateSet(objectValue, null, "Visible", new object[] { true }, null, null);
                NewLateBinding.LateCall(instance, null, "Activate", new object[0], null, null, null, true);
                NewLateBinding.LateCall(obj4, null, "Activate", new object[0], null, null, null, true);
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                obj4 = null;
                instance = null;
                objectValue = null;
                GC.Collect();
                throw exception;
            }
            finally
            {
                MyProject.Forms.Main.StatusLabel.Text = "Bereit";
                MyProject.Forms.Main.StatusProgress.Value = 0;
            }
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            this.components = new Container();
            DataGridViewCellStyle style = new DataGridViewCellStyle();
            this.ToolStrip1 = new ToolStrip();
            this.ToolStripLabelSuchen = new ToolStripLabel();
            this.ToolStripTextBoxSuchen = new ToolStripTextBox();
            this.ToolStripSeparator1 = new ToolStripSeparator();
            this.ToolStripLabel1 = new ToolStripLabel();
            this.ToolStripComboBoxJahre = new ToolStripComboBox();
            this.ToolStripSeparator2 = new ToolStripSeparator();
            this.DataGridView1 = new DataGridView();
            this.ToolStripButtonExportToExcel = new ToolStripButton();
            this.TAB_HistorieBindingSource = new BindingSource(this.components);
            this.DatenschemaBMW = new DatenschemaBMW();
            this.FGSTNrDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
            this.NameDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
            this.KreditNrDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
            this.AbloeseBetragDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
            this.AbloeseDatumDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
            this.Kunden_Nr = new DataGridViewTextBoxColumn();
            this.REDatVKDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
            this.RENrVKDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
            this.ToolStrip1.SuspendLayout();
            ((ISupportInitialize) this.DataGridView1).BeginInit();
            ((ISupportInitialize) this.TAB_HistorieBindingSource).BeginInit();
            this.DatenschemaBMW.BeginInit();
            this.SuspendLayout();
            this.ToolStrip1.Items.AddRange(new ToolStripItem[] { this.ToolStripLabelSuchen, this.ToolStripTextBoxSuchen, this.ToolStripSeparator1, this.ToolStripLabel1, this.ToolStripComboBoxJahre, this.ToolStripSeparator2, this.ToolStripButtonExportToExcel });
            Point point = new Point(0, 0);
            this.ToolStrip1.Location = point;
            this.ToolStrip1.Name = "ToolStrip1";
            Size size = new Size(0x3ab, 0x19);
            this.ToolStrip1.Size = size;
            this.ToolStrip1.TabIndex = 0;
            this.ToolStrip1.Text = "ToolStrip1";
            this.ToolStripLabelSuchen.Name = "ToolStripLabelSuchen";
            size = new Size(0x2c, 0x16);
            this.ToolStripLabelSuchen.Size = size;
            this.ToolStripLabelSuchen.Text = "Suchen";
            this.ToolStripLabelSuchen.TextAlign = ContentAlignment.MiddleLeft;
            this.ToolStripTextBoxSuchen.Name = "ToolStripTextBoxSuchen";
            size = new Size(100, 0x19);
            this.ToolStripTextBoxSuchen.Size = size;
            this.ToolStripSeparator1.Name = "ToolStripSeparator1";
            size = new Size(6, 0x19);
            this.ToolStripSeparator1.Size = size;
            this.ToolStripLabel1.Name = "ToolStripLabel1";
            size = new Size(30, 0x16);
            this.ToolStripLabel1.Size = size;
            this.ToolStripLabel1.Text = "Jahr:";
            this.ToolStripComboBoxJahre.Name = "ToolStripComboBoxJahre";
            size = new Size(0x79, 0x19);
            this.ToolStripComboBoxJahre.Size = size;
            this.ToolStripSeparator2.Name = "ToolStripSeparator2";
            size = new Size(6, 0x19);
            this.ToolStripSeparator2.Size = size;
            this.DataGridView1.AllowUserToAddRows = false;
            this.DataGridView1.AllowUserToDeleteRows = false;
            this.DataGridView1.AutoGenerateColumns = false;
            this.DataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.DataGridView1.Columns.AddRange(new DataGridViewColumn[] { this.FGSTNrDataGridViewTextBoxColumn, this.NameDataGridViewTextBoxColumn, this.KreditNrDataGridViewTextBoxColumn, this.AbloeseBetragDataGridViewTextBoxColumn, this.AbloeseDatumDataGridViewTextBoxColumn, this.Kunden_Nr, this.REDatVKDataGridViewTextBoxColumn, this.RENrVKDataGridViewTextBoxColumn });
            this.DataGridView1.DataSource = this.TAB_HistorieBindingSource;
            this.DataGridView1.Dock = DockStyle.Fill;
            point = new Point(0, 0x19);
            this.DataGridView1.Location = point;
            this.DataGridView1.Name = "DataGridView1";
            this.DataGridView1.ReadOnly = true;
            this.DataGridView1.RowHeadersVisible = false;
            size = new Size(0x3ab, 0x206);
            this.DataGridView1.Size = size;
            this.DataGridView1.TabIndex = 1;
            this.ToolStripButtonExportToExcel.DisplayStyle = ToolStripItemDisplayStyle.Image;
            this.ToolStripButtonExportToExcel.Image = Resources.Excel;
            this.ToolStripButtonExportToExcel.ImageTransparentColor = Color.Magenta;
            this.ToolStripButtonExportToExcel.Name = "ToolStripButtonExportToExcel";
            size = new Size(0x17, 0x16);
            this.ToolStripButtonExportToExcel.Size = size;
            this.ToolStripButtonExportToExcel.Text = "ToolStripButtonExportToExcel";
            this.TAB_HistorieBindingSource.DataMember = "TAB_Historie";
            this.TAB_HistorieBindingSource.DataSource = this.DatenschemaBMW;
            this.DatenschemaBMW.DataSetName = "DatenschemaBMW";
            this.DatenschemaBMW.SchemaSerializationMode = SchemaSerializationMode.IncludeSchema;
            this.FGSTNrDataGridViewTextBoxColumn.DataPropertyName = "FGST_Nr";
            this.FGSTNrDataGridViewTextBoxColumn.HeaderText = "Fahrgestell-Nr.";
            this.FGSTNrDataGridViewTextBoxColumn.Name = "FGSTNrDataGridViewTextBoxColumn";
            this.FGSTNrDataGridViewTextBoxColumn.ReadOnly = true;
            this.FGSTNrDataGridViewTextBoxColumn.Width = 90;
            this.NameDataGridViewTextBoxColumn.DataPropertyName = "Name";
            this.NameDataGridViewTextBoxColumn.HeaderText = "Name";
            this.NameDataGridViewTextBoxColumn.Name = "NameDataGridViewTextBoxColumn";
            this.NameDataGridViewTextBoxColumn.ReadOnly = true;
            this.NameDataGridViewTextBoxColumn.Width = 150;
            this.KreditNrDataGridViewTextBoxColumn.DataPropertyName = "Kredit_Nr";
            this.KreditNrDataGridViewTextBoxColumn.HeaderText = "Kredit-Nr.";
            this.KreditNrDataGridViewTextBoxColumn.Name = "KreditNrDataGridViewTextBoxColumn";
            this.KreditNrDataGridViewTextBoxColumn.ReadOnly = true;
            this.KreditNrDataGridViewTextBoxColumn.Width = 0x4c;
            this.AbloeseBetragDataGridViewTextBoxColumn.DataPropertyName = "Abloese_Betrag";
            style.Format = "N2";
            this.AbloeseBetragDataGridViewTextBoxColumn.DefaultCellStyle = style;
            this.AbloeseBetragDataGridViewTextBoxColumn.HeaderText = "Ablöse Betrag";
            this.AbloeseBetragDataGridViewTextBoxColumn.Name = "AbloeseBetragDataGridViewTextBoxColumn";
            this.AbloeseBetragDataGridViewTextBoxColumn.ReadOnly = true;
            this.AbloeseDatumDataGridViewTextBoxColumn.DataPropertyName = "Abloese_Datum";
            this.AbloeseDatumDataGridViewTextBoxColumn.HeaderText = "Ablöse-Datum";
            this.AbloeseDatumDataGridViewTextBoxColumn.Name = "AbloeseDatumDataGridViewTextBoxColumn";
            this.AbloeseDatumDataGridViewTextBoxColumn.ReadOnly = true;
            this.Kunden_Nr.DataPropertyName = "Kunden_Nr";
            this.Kunden_Nr.HeaderText = "Kunden-Nr.";
            this.Kunden_Nr.Name = "Kunden_Nr";
            this.Kunden_Nr.ReadOnly = true;
            this.REDatVKDataGridViewTextBoxColumn.DataPropertyName = "RE_Dat_VK";
            this.REDatVKDataGridViewTextBoxColumn.HeaderText = "Rechnungsdatum VK";
            this.REDatVKDataGridViewTextBoxColumn.Name = "REDatVKDataGridViewTextBoxColumn";
            this.REDatVKDataGridViewTextBoxColumn.ReadOnly = true;
            this.REDatVKDataGridViewTextBoxColumn.Width = 0x85;
            this.RENrVKDataGridViewTextBoxColumn.DataPropertyName = "RE_Nr_VK";
            this.RENrVKDataGridViewTextBoxColumn.HeaderText = "Rechnungs-Nr. VK";
            this.RENrVKDataGridViewTextBoxColumn.Name = "RENrVKDataGridViewTextBoxColumn";
            this.RENrVKDataGridViewTextBoxColumn.ReadOnly = true;
            this.RENrVKDataGridViewTextBoxColumn.Width = 0x79;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            size = new Size(0x3ab, 0x21f);
            this.ClientSize = size;
            this.Controls.Add(this.DataGridView1);
            this.Controls.Add(this.ToolStrip1);
            this.FormBorderStyle = FormBorderStyle.None;
            this.Name = "frmHistorie";
            this.Text = "frmHistorie";
            this.ToolStrip1.ResumeLayout(false);
            this.ToolStrip1.PerformLayout();
            ((ISupportInitialize) this.DataGridView1).EndInit();
            ((ISupportInitialize) this.TAB_HistorieBindingSource).EndInit();
            this.DatenschemaBMW.EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();
        }

        private void InnerCbx_SelectionChangeCommitted(object sender, EventArgs e)
        {
            if (this.CbxEventsEnabled)
            {
                if (Operators.ConditionalCompareObjectEqual(this.InnerCbx.SelectedItem, "Alle", false))
                {
                    DateTime time = DateTime.Now;
                    this.StartDatum = time;
                    this.EndDatum = time;
                }
                else
                {
                    this.StartDatum = Conversions.ToDate(Operators.AddObject("01.01.", this.InnerCbx.SelectedItem));
                    this.EndDatum = Conversions.ToDate(Operators.AddObject("31.12.", this.InnerCbx.SelectedItem));
                }
                this.SetFilter(this.ToolStripTextBoxSuchen.Text);
            }
        }

        private void SetFilter(string Item)
        {
            // SBA Modifiziert war vorher nicht zugewiesen.
            DateTime time = new DateTime(0);
            string str = "";
            if (Item.Length > 0)
            {
                DateTime time2;
                str = "FGST_Nr LIKE'%" + Item + "%' OR Name LIKE '%" + Item + "%' Or Kredit_Nr LIKE '%" + Item + "%' Or Re_Nr_Vk LIKE '%" + Item + "%'";
                decimal result = new decimal();
                string s = Item;
                if (decimal.TryParse(s, out result))
                {
                    s = s.Replace(".", "").Replace(",", ".");
                    str = str + " OR Abloese_Betrag=" + s;
                }
                if (DateTime.TryParse(Item, out time2))
                {
                    str = str + " OR Abloese_Datum=" + time2.ToString(@"#MM\/dd\/yyyy#");
                }
            }
            if (DateTime.Compare(this.StartDatum, time) != 0)
            {
                if (str.Length > 0)
                {
                    str = "(" + str + ") AND (Abloese_Datum>=" + this.StartDatum.ToString(@"#MM\/dd\/yyyy#") + " AND Abloese_Datum<=" + this.EndDatum.ToString(@"#MM\/dd\/yyyy#") + ")";
                }
                else
                {
                    str = "Abloese_Datum>=" + this.StartDatum.ToString(@"#MM\/dd\/yyyy#") + " AND Abloese_Datum<=" + this.EndDatum.ToString(@"#MM\/dd\/yyyy#");
                }
            }
            try
            {
                this.dvHist.RowFilter = str;
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                Interaction.MsgBox("Der eingegebene Suchbegriff hat zu einem Fehler geführt.\r\nBitte verständigen Sie den Support.", MsgBoxStyle.Exclamation, "Fehler");
                this.dvHist.RowFilter = "";
                this.CbxEventsEnabled = false;
                this.InnerCbx.SelectedItem = "Alles";
                this.CbxEventsEnabled = true;
                ProjectData.ClearProjectError();
            }
        }

        private void ToolStripButtonExportToExcel_Click(object sender, EventArgs e)
        {
            try
            {
                this.GridToExcel(this.DataGridView1);
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                Interaction.MsgBox("Unerwarteter Fehler bei der Ausgabe der Daten nach Excel.\r\n" + exception.Message, MsgBoxStyle.Critical, "Schwerer Fehler");
                ProjectData.ClearProjectError();
            }
        }

        private void ToolStripTextBoxSuchen_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Return)
            {
                this.SetFilter(this.ToolStripTextBoxSuchen.Text);
            }
        }

        internal virtual DataGridViewTextBoxColumn AbloeseBetragDataGridViewTextBoxColumn
        {
            [DebuggerNonUserCode]
            get
            {
                return this._AbloeseBetragDataGridViewTextBoxColumn;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._AbloeseBetragDataGridViewTextBoxColumn = value;
            }
        }

        internal virtual DataGridViewTextBoxColumn AbloeseDatumDataGridViewTextBoxColumn
        {
            [DebuggerNonUserCode]
            get
            {
                return this._AbloeseDatumDataGridViewTextBoxColumn;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._AbloeseDatumDataGridViewTextBoxColumn = value;
            }
        }

        internal virtual DataGridView DataGridView1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._DataGridView1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._DataGridView1 = value;
            }
        }

        internal virtual DatenschemaBMW DatenschemaBMW
        {
            [DebuggerNonUserCode]
            get
            {
                return this._DatenschemaBMW;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._DatenschemaBMW = value;
            }
        }

        internal virtual DataGridViewTextBoxColumn FGSTNrDataGridViewTextBoxColumn
        {
            [DebuggerNonUserCode]
            get
            {
                return this._FGSTNrDataGridViewTextBoxColumn;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._FGSTNrDataGridViewTextBoxColumn = value;
            }
        }

        private ComboBox InnerCbx
        {
            [DebuggerNonUserCode]
            get
            {
                return this._InnerCbx;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.InnerCbx_SelectionChangeCommitted);
                if (this._InnerCbx != null)
                {
                    this._InnerCbx.SelectionChangeCommitted -= handler;
                }
                this._InnerCbx = value;
                if (this._InnerCbx != null)
                {
                    this._InnerCbx.SelectionChangeCommitted += handler;
                }
            }
        }

        internal virtual DataGridViewTextBoxColumn KreditNrDataGridViewTextBoxColumn
        {
            [DebuggerNonUserCode]
            get
            {
                return this._KreditNrDataGridViewTextBoxColumn;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._KreditNrDataGridViewTextBoxColumn = value;
            }
        }

        internal virtual DataGridViewTextBoxColumn Kunden_Nr
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Kunden_Nr;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Kunden_Nr = value;
            }
        }

        internal virtual DataGridViewTextBoxColumn NameDataGridViewTextBoxColumn
        {
            [DebuggerNonUserCode]
            get
            {
                return this._NameDataGridViewTextBoxColumn;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._NameDataGridViewTextBoxColumn = value;
            }
        }

        internal virtual DataGridViewTextBoxColumn REDatVKDataGridViewTextBoxColumn
        {
            [DebuggerNonUserCode]
            get
            {
                return this._REDatVKDataGridViewTextBoxColumn;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._REDatVKDataGridViewTextBoxColumn = value;
            }
        }

        internal virtual DataGridViewTextBoxColumn RENrVKDataGridViewTextBoxColumn
        {
            [DebuggerNonUserCode]
            get
            {
                return this._RENrVKDataGridViewTextBoxColumn;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._RENrVKDataGridViewTextBoxColumn = value;
            }
        }

        internal virtual BindingSource TAB_HistorieBindingSource
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TAB_HistorieBindingSource;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TAB_HistorieBindingSource = value;
            }
        }

        internal virtual ToolStrip ToolStrip1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ToolStrip1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._ToolStrip1 = value;
            }
        }

        internal virtual ToolStripButton ToolStripButtonExportToExcel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ToolStripButtonExportToExcel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.ToolStripButtonExportToExcel_Click);
                if (this._ToolStripButtonExportToExcel != null)
                {
                    this._ToolStripButtonExportToExcel.Click -= handler;
                }
                this._ToolStripButtonExportToExcel = value;
                if (this._ToolStripButtonExportToExcel != null)
                {
                    this._ToolStripButtonExportToExcel.Click += handler;
                }
            }
        }

        internal virtual ToolStripComboBox ToolStripComboBoxJahre
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ToolStripComboBoxJahre;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._ToolStripComboBoxJahre = value;
            }
        }

        internal virtual ToolStripLabel ToolStripLabel1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ToolStripLabel1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._ToolStripLabel1 = value;
            }
        }

        internal virtual ToolStripLabel ToolStripLabelSuchen
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ToolStripLabelSuchen;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._ToolStripLabelSuchen = value;
            }
        }

        internal virtual ToolStripSeparator ToolStripSeparator1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ToolStripSeparator1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._ToolStripSeparator1 = value;
            }
        }

        internal virtual ToolStripSeparator ToolStripSeparator2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ToolStripSeparator2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._ToolStripSeparator2 = value;
            }
        }

        internal virtual ToolStripTextBox ToolStripTextBoxSuchen
        {
            [DebuggerNonUserCode]
            get
            {
                return this._ToolStripTextBoxSuchen;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                KeyEventHandler handler = new KeyEventHandler(this.ToolStripTextBoxSuchen_KeyDown);
                if (this._ToolStripTextBoxSuchen != null)
                {
                    this._ToolStripTextBoxSuchen.KeyDown -= handler;
                }
                this._ToolStripTextBoxSuchen = value;
                if (this._ToolStripTextBoxSuchen != null)
                {
                    this._ToolStripTextBoxSuchen.KeyDown += handler;
                }
            }
        }
    }
}

